<?php
require_once 'Service/Condition/ZendDb/Comparison.php';

/**
 * Is NULL condition.
 *
 * @author baziak
 */
class Service_Condition_ZendDb_IsNull extends Service_Condition_ZendDb_Comparison
{
    protected $_operator = 'IS';

    public function __construct($params)
    {
        if (is_string($params)) {
            $params = array('field' => $params);
        }

        parent::__construct($params);
    }

    public function __toString()
    {
        $db = $this->getDataSource()->getAdapter();

        $field = $db->quoteIdentifier($this->_params['field']);

        return $field .' '. $this->_operator .' NULL';
    }
}
